package com.hzyl.famousreader.repository.persistence.dao;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import com.hzyl.famousreader.repository.persistence.entity.Ad;

import java.util.List;

@Dao
public interface AdDao {

  @Insert(onConflict = OnConflictStrategy.REPLACE)
  void insert(List<Ad> adList);

  @Query("select * from ad order by sort, start_expiry desc, end_expiry asc")
  LiveData<List<Ad>> selectAds();
}
